package org.vgou.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * Copyright (c) 2011, vgou All rights reserved.
 * 
 * @since Nov 27, 2011
 * @author <a href="mailto:jason.hxx@gmail.com">jason</a>
 * @version Id: ProductItem.java Nov 27, 2011
 * @comment 产品条目实体类
 * 
 */
@Entity
// 更新一个对象时,会生成动态SQL,当属性值发生变化时，才会包含到UPDATE语句中
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
@Table(name = "productitem")
public class ProductItem implements Serializable {

	private static final long serialVersionUID = -7509361156307475911L;

	/** 编号 **/
	@Id
	@GeneratedValue
	@Column(name="id", length=19)
	private long id;
	
	/** 条目名称  **/
	@Column(name="itemname", nullable=false)
	private String itemName;
	

	/** 条目描述  **/
	@Column(name="description")
	private String description;
	
	
	/** 所属产品 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="productid")
	private Product product;

	public ProductItem() {
		super();
	}

	public ProductItem(long id, String itemName, String description,
			Product product) {
		super();
		this.id = id;
		this.itemName = itemName;
		this.description = description;
		this.product = product;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}


	public Product getProduct() {
		return product;
	}


	public void setProduct(Product product) {
		this.product = product;
	}

}
